﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace WinSat
{
    public class Fuar
    {
        public string CariUnvani(string filtre)
        {
            string sonuc;
            using (Query q = new Query())
            {
                q.Add("@kod", System.Data.SqlDbType.NVarChar, filtre, 25);
                q.Add("select (SELECT  name + ';' + order_series + ';' + (case when logged_in =1 then 'var' else 'yok' end) as durum FROM         CUSTOMERS  WITH (NOLOCK)  WHERE  (code = @kod))");
                sonuc = q.ExecScaler<string>();
            }
            return sonuc;
        }

        public DataTable CariListeAd(string filtre)
        {
            DataTable sonuc;
            using (Query q = new Query())
            {
                q.Add("@kod", System.Data.SqlDbType.NVarChar, filtre + "%", 25);
                q.Add("SELECT     code AS [Müşteri Kodu], name AS [Müşteri Ünvanı],order_series as [Evrak Seri] FROM         CUSTOMERS  WITH (NOLOCK)  WHERE  (code not like '320%') and  (name LIKE @kod) and (logged_in=1)");
                sonuc = q.Fill();
            }
            return sonuc;
        }
    }
}
